<template>
    <div class="addressContent u-skeleton">

        <u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>

        <view class="content">
            <view class="list" v-if="addressList.length>0">
                <view 
                    class="row"
                    v-for="(row,index) in addressList" 
                    :key="index"
                    @click="select(row)"
                >
                    <view class="left">
                        <view class="head u-skeleton-circle">
                            {{row.name.substr(0,1)}}
                        </view>
                    </view>
                    <view class="center">
                        <view class="name-tel">
                            <view class="name u-skeleton-fillet">{{row.name}}</view>
                            <view class="tel u-skeleton-fillet">{{row.moblie}}</view>
                            <view class="default" v-if="row.is_default">
                                默认
                            </view>
                        </view>
                        <view class="address u-skeleton-fillet">
                            {{mySchool.mySchool.school_name}} - {{row.address}}
                        </view>
                    </view>
                    <view class="right">

                        <div @click.stop="goToPage({
                            path:`/generalUser/address/edit/edit`,
                            navType:`push`,
                            params:{
                                type:`edit`,
                                id:row._id
                            }
                        })">

                            <uni-icons 
                            type="compose" 
                            class="modiftyIcon modiftyIcon0 u-skeleton-fillet" 
                            color="#f37000" 
                            size="24" 
                            ></uni-icons>

                        </div>

                        <div  @click.stop="remove(row)">
                            <uni-icons type="trash" class="modiftyIcon modiftyIcon1 u-skeleton-fillet" color="#f00" size="24"></uni-icons>
                        </div>
                    </view>
                </view>
            </view>

            <div class="noDataBox centerFixed" v-else>
                <div class="noDataBorder">
                    <image src="~@/static/images/nodata.png" class="nodataPic"/>
                </div>
                <div class="noDataTips">
                    暂无任何地址，马上去新增~
                </div>
            </div>

        </view>
        <view class="add">
            <view class="btn" @click="goToPage({
                path:`/generalUser/address/edit/edit`,
                navType:`push`,
                params:{
                    type:`add`
                }
            })">
                <view class="icon tianjia"></view>新增地址
            </view>
        </view>
    </div>
</template>

<script src="./address.ts" lang="ts"></script>

<style lang="stylus" scoped>
@import './address.styl';
</style>
